<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="ajile/com.iskitz.ajile.js?mvcoff,mvcshareoff,refresh"></script>
<script type="text/javascript" src="org.wattdepot.gdata.GDataLoader.js"></script>
<script type="text/javascript" src="org.wattdepot.gdata.kukuicup.Configuration.js"></script>
<script type="text/javascript" src="org.wattdepot.gdata.makahiki.EnergyRank.js"></script>
</head>

<body>
  <div id="header-rank">
    <h3 style="display:inline" id="rank"></h3> out of 15 lounges in all dorms.
  </div>
  <div id="header-energy">
    <h3 style="display:inline" id="energy"></h3> used in the last hour.
  </div>
  
  <div id="current leader">
    Current Leader: <span id="leader"></span>
  </div>
</body>

 
<script type="text/javascript">
// Wrap this code in an anonymous self-invoking function to avoid polluting global namespace.
(function() {
  var configuration = new org.wattdepot.gdata.kukuicup.Configuration();
 
  // The source for which we want to find the rank must be specified by Makahiki.
  var source = configuration.ilima_3_4;

  // Get the spreadsheets we need.
  var rollingHoursEnergyUrl = configuration.getRollingHoursEnergyUrl();
  // console.log(rollingHoursEnergyUrl);
  var refreshInterval = 0; // don't refresh this spreadsheet.

  // Load the visualization API and the spreadsheet, then call displayRank.
  var loader = new org.wattdepot.gdata.GDataLoader(displayRank, rollingHoursEnergyUrl, refreshInterval);  

  function displayRank(rollingHoursDatatable) {
    var energyRank = new org.wattdepot.gdata.makahiki.EnergyRank(configuration);
    var rankInfo = energyRank.calculateRankInfo(rollingHoursDatatable, source);
    energyRank.draw('rank', 'energy', rankInfo);
    
    var leaderInfo = energyRank.calculateLeader(rollingHoursDatatable);
    energyRank.insertLeader('leader', leaderInfo);
  }
})();
</script>

</html>








